﻿<UserControl
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    mc:Ignorable="d" xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls" x:Class="SilverlightFTP.MainPage"
    d:DesignWidth="640" Height="356">
    <Grid Background="LightBlue"  x:Name="LayoutRoot" Width="640" Height="356">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" MinWidth="640"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="22"/>
            <RowDefinition Height="399"/>
        </Grid.RowDefinitions>
        <StackPanel Grid.Row="0" Orientation="Horizontal">
            <TextBlock Text="Host" TextWrapping="Wrap" Height="17" Margin="3,0" VerticalAlignment="Bottom" FontSize="10.667" FontWeight="Bold"/>
            <TextBox x:Name="TbHost" Width="166" FontSize="10.667" Text="195.128.121.26" />
            <TextBlock TextWrapping="Wrap" Margin="3,4,3,0" FontSize="10.667" Text="Login" FontWeight="Bold"/>
            <TextBox x:Name="TbUser" Width="100" Margin="0" FontSize="10.667" Text="fudzen123-1" />
            <TextBlock Text="Password" TextWrapping="Wrap" Margin="3,4,3,0" FontSize="10.667" FontWeight="Bold"/>
            <PasswordBox x:Name="TbPass" Width="108" FontSize="10.667" Password="OO3NP,MMyN"/>
            <Button x:Name="ConnectButton" Click="ConnectButton_Click" Width="92" Content="Connect" Margin="15,0,0,0"/>
        </StackPanel>
        <Popup VerticalOffset="0" HorizontalOffset="0" Name="popUp" Height="auto" Width="auto" >

            <Grid x:Name="PopupLay" Width="640" Height="356" Background="AliceBlue" Opacity="0.9" OpacityMask="AliceBlue" >

                <Grid.RowDefinitions>
                    <RowDefinition Height="*"></RowDefinition>
                    <RowDefinition  Height="30"></RowDefinition>
                    <RowDefinition Height="30"></RowDefinition>

                    <RowDefinition Height="30"></RowDefinition>

                    <RowDefinition Height="40"></RowDefinition>
                    <RowDefinition Height="*"></RowDefinition>
                </Grid.RowDefinitions>
                <TextBlock x:Name="CurrentNameTextBlock" Visibility="Collapsed"  Grid.Row="0"></TextBlock>
                <TextBlock x:Name="CurrentNameIsFolder" Visibility="Collapsed"  Grid.Row="0"></TextBlock>
                <TextBlock HorizontalAlignment="Center" FontSize="16" x:Name="NewNameTextBlock" Text="Type new name." Grid.Row="1"></TextBlock>
                <TextBox  x:Name="EditTextBox" Grid.Row="2" Height="22" Width="300"></TextBox>
                <StackPanel HorizontalAlignment="Center" Orientation="Horizontal" Grid.Row="3">
                    <Button x:Name="OkRenButton" Click="OkRenButton_Click" Content="Ok" Margin="0,0,10,0"  Height="30" Width="60"></Button>
                    <Button x:Name="CancelRenButton" Click="CancelRenButton_Click" Content="Cancel" Height="30" Width="60"></Button>
                </StackPanel>



            </Grid>

        </Popup>
        <Popup VerticalOffset="0" HorizontalOffset="0" Name="ExistsPopUp" Height="auto" Width="auto" >

            <Grid x:Name="ExistPopupLay" Width="640" Height="356" Background="AliceBlue" Opacity="0.9" OpacityMask="AliceBlue" >

                <Grid.RowDefinitions>
                    <RowDefinition Height="*"></RowDefinition>
                    <RowDefinition Height="30"></RowDefinition>

                    <RowDefinition Height="30"></RowDefinition>

                    <RowDefinition Height="40"></RowDefinition>
                    <RowDefinition Height="*"></RowDefinition>
                </Grid.RowDefinitions>
                <StackPanel HorizontalAlignment="Center" Orientation="Horizontal" Grid.Row="1"><TextBlock FontSize="12" x:Name="ExistsText"   Grid.Row="1"></TextBlock></StackPanel>
                <StackPanel HorizontalAlignment="Center" Orientation="Horizontal" Grid.Row="2">
                    <Button x:Name="OkExistsButton" Click="OkExistsButton_Click"  Content="Ok" Margin="0,0,10,0"  Height="30" Width="60"></Button>
                    <Button x:Name="CancelExistsButton" Click="CancelExistsButton_Click"  Content="Cancel" Height="30" Width="60"></Button>
                </StackPanel>



            </Grid>

        </Popup>
        <ListBox  ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Visible" MouseLeftButtonDown="ListBox1_MouseLeftButtonDown"  Grid.Row="1" x:Name="FileBox" Margin="0,18,229,92">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <StackPanel  Loaded="ItemContentPanel_Loaded" x:Name="ItemContentPanel" Width="384" Height="22" Orientation="Horizontal">
                        <CheckBox IsChecked="{Binding IsSelected}" IsEnabled="{Binding EnabledForFolders}" Opacity="{Binding NoOpacityForFolders}" Checked="CheckBox_Checked" Unchecked="CheckBox_Unchecked" Height="18" Width="19" Content="CheckBox"/>
                        <Image Width="13" Height="16" Visibility="{Binding FolderIcon}" Source="images/folder.png"></Image>
                        <Image Width="13" Height="16" Visibility="{Binding FileIcon}" Source="images/file.png"></Image>
                        <TextBlock x:Name="ItemName" Text="{Binding Name}"  HorizontalAlignment="Left" Margin="0" Width="185" FontSize="10.667" TextWrapping="Wrap" />
                        <TextBlock Height="14" Text="{Binding StrFilesize}" Width="71" TextWrapping="Wrap" Margin="0,4"/>
                        <StackPanel  x:Name="ButtonsPanel" Orientation="Horizontal">
                            <Button IsEnabled="{Binding DisabledForFolders}" Opacity="{Binding OpacityForFolders}" Height="19" x:Name="DownloadItemButton" HorizontalAlignment="Right" Width="19" FontSize="9.333" Margin="4,2,0,1" Click="DownloadButton_Click" >
                                <Image Source="images/save.png"/>
                            </Button>
                            <Button IsEnabled="{Binding EnabledForFolders}" Opacity="{Binding NoOpacityForFolders}" Height="19" x:Name="CopyItemButton" HorizontalAlignment="Right" Width="19" FontSize="9.333" Margin="4,2,0,1" Click="CopyItemButton_Click" >
                                <Image Source="images/copy.png"/>
                            </Button>

                            <Button IsEnabled="{Binding EnabledForFolders}" Opacity="{Binding NoOpacityForFolders}"  Height="19" x:Name="RenameItemButton" HorizontalAlignment="Right" Width="19" FontSize="9.333" Click="RenameButton_Click" Margin="5,2,0,1">
                                <Image Source="images/rename.png"></Image>
                            </Button>
                            <Button IsEnabled="{Binding EnabledForFolders}" Opacity="{Binding NoOpacityForFolders}"  Height="19" x:Name="DeleteItemButton" Click="DeleteItemButton_Click" HorizontalAlignment="Right" Width="19" FontSize="9.333" Margin="4,2,0,1" RenderTransformOrigin="0.933,0.263">
                                <Image Source="images/delete.png"/>
                            </Button>
                        </StackPanel>
                    </StackPanel>
                </DataTemplate>

            </ListBox.ItemTemplate>

        </ListBox>
        <Rectangle Stroke="Black" Height="30" HorizontalAlignment="Right" Margin="0,0,0,62" VerticalAlignment="Bottom" Width="225" Grid.Row="1" StrokeThickness="0" RadiusX="3" RadiusY="3">
            <Rectangle.Fill>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="White" Offset="0"/>
                    <GradientStop Color="LightBlue" Offset="1"/>
                </LinearGradientBrush>
            </Rectangle.Fill>
        </Rectangle>
        <Button x:Name="CancelAllButton" Height="21" Click="CancelAllButton_Click" HorizontalAlignment="Right" Margin="0,0,125,69" VerticalAlignment="Bottom" Width="94" Grid.Row="1" Content="CancelAll" FontSize="10.667" />
        <Rectangle Stroke="Black" StrokeThickness="0" RadiusX="3" RadiusY="3" Height="30" Margin="0,0,233,62" VerticalAlignment="Bottom" Grid.Row="1">
            <Rectangle.Fill>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="White" Offset="0"/>
                    <GradientStop Color="LightBlue" Offset="1"/>
                </LinearGradientBrush>
            </Rectangle.Fill>
        </Rectangle>
        <Button Click="DeleteCheckedButton_Click" Height="21" Margin="97,0,0,69" VerticalAlignment="Bottom" Grid.Row="1" HorizontalAlignment="Left" Width="20" FontSize="10.667" >
            <Image Source="images/delete.png"></Image>
        </Button>
        <Button Click="UploadButton_Click" Height="21" Margin="316,0,240,69" VerticalAlignment="Bottom" Grid.Row="1" Content="Upload..." FontSize="10.667"/>
        <controls:TabControl HorizontalAlignment="Right" Margin="0,0,0,92" Width="229" Grid.Row="1">
            <controls:TabItem Header="Uploading">
                <Grid>
                    <ListBox x:Name="ProgressBox" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Visible">
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <Grid Width="235">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="0.539*"/>
                                        <ColumnDefinition Width="0.461*"/>
                                    </Grid.ColumnDefinitions>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="0.5*"/>
                                        <RowDefinition Height="0.5*"/>
                                    </Grid.RowDefinitions>
                                    <ProgressBar x:Name="Progress"  Value="{Binding Progress, Mode=OneWay}" Margin="3,0,0,0" Grid.Row="1"/>
                                    <TextBlock Margin="3,1,0,0" FontSize="10.667" Text="{Binding FileName}" TextWrapping="Wrap"/>
                                    <TextBlock Text="{Binding Datalength}" TextWrapping="Wrap" Margin="4,1,44,2" Grid.Column="1"/>
                                    <Button Click="CancelButton_Click"  Margin="4,0,50,0" Grid.Column="1" Grid.Row="1" Content="Cancel" FontSize="9.333"/>
                                </Grid>
                            </DataTemplate>
                        </ListBox.ItemTemplate>

                    </ListBox>
                </Grid>
            </controls:TabItem>
            <controls:TabItem Header="Downloading">
                <Grid>

                    <ListBox x:Name="DownProgressBox" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Visible">
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <Grid Width="235">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="0.539*"/>
                                        <ColumnDefinition Width="0.461*"/>
                                    </Grid.ColumnDefinitions>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="0.5*"/>
                                        <RowDefinition Height="0.5*"/>
                                    </Grid.RowDefinitions>
                                    <ProgressBar x:Name="Progress"  Value="{Binding Progress, Mode=OneWay}" Margin="3,0,0,0" Grid.Row="1"/>
                                    <TextBlock Margin="3,1,0,0" FontSize="10.667" Text="{Binding FileName}" TextWrapping="Wrap"/>
                                    <TextBlock Text="Size" TextWrapping="Wrap" Margin="4,1,44,2" Grid.Column="1"/>
                                    <Button Click="CancelDownButton_Click"  Margin="4,0,50,0" Grid.Column="1" Grid.Row="1" Content="Cancel" FontSize="9.333"/>
                                </Grid>
                            </DataTemplate>
                        </ListBox.ItemTemplate>

                    </ListBox>
                </Grid>
            </controls:TabItem>
        </controls:TabControl>
        <Rectangle Height="18" Margin="0,0,229,0" VerticalAlignment="Top" Grid.Row="1">
            <Rectangle.Stroke>
                <SolidColorBrush/>
            </Rectangle.Stroke>
            <Rectangle.Fill>
                <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                    <GradientStop Color="#FFD4D4D4" Offset="1"/>
                    <GradientStop Color="White"/>
                </LinearGradientBrush>
            </Rectangle.Fill>
        </Rectangle>

        <Button Height="18" HorizontalAlignment="Left" Click="ASortingButton_Click"  Margin="20,0,0,0" x:Name="ASortingButton" VerticalAlignment="Top" Width="200" Grid.Row="1">
            <StackPanel Orientation="Horizontal" Width="205">
                <Image Source="images/collapse.jpg" Margin="0"></Image>
                <TextBlock Height="13" Text="Name" Width="60" FontSize="10" TextWrapping="Wrap" Margin="0,0,-186,0"/>
            </StackPanel>
        </Button>
        <Button Height="18" Click="SSortingButton_Click"  x:Name="SSortingButton"  Margin="220,0,0,0" VerticalAlignment="Top" Grid.Row="1" HorizontalAlignment="Left" Width="77">
            <StackPanel Orientation="Horizontal">
                <Image Source="images/collapse.jpg" Margin="-19,0,0,0"></Image>
                <TextBlock Height="13" Text="Size" Width="43" FontSize="10" TextWrapping="Wrap" Margin="0,0,-6,0"></TextBlock>
            </StackPanel>
        </Button>
        <Button x:Name="CopySelectedButton" Click="CopySelectedButton_Click"  Height="21" Margin="147,0,0,69" VerticalAlignment="Bottom" Grid.Row="1" FontSize="10.667" HorizontalAlignment="Left" Width="21">
            <Image Source="images/copy.png"></Image>
        </Button>
        <Button x:Name="PasteSelectedButton" Click="PasteSelectedButton_Click"  Height="21" Margin="122,0,0,69" VerticalAlignment="Bottom" Grid.Row="1" FontSize="10.667" HorizontalAlignment="Left" Width="21">
            <Image Source="images/paste.png"></Image>
        </Button>
        <TextBlock Height="19" HorizontalAlignment="Left" Margin="35,0,0,68" VerticalAlignment="Bottom" Width="60" Grid.Row="1" Text="Selected:" TextWrapping="Wrap"/>
        <Button Height="18" HorizontalAlignment="Left" VerticalAlignment="Top" x:Name="CheckAllButton" Width="20" Content="" Grid.Row="1" RenderTransformOrigin="0.5,0.5"  IsTabStop="False" Margin="1,0,0,0" Click="CheckAllButton_Click">
            <Button.RenderTransform>
                <TransformGroup>
                    <ScaleTransform/>
                    <SkewTransform/>
                    <RotateTransform/>
                    <TranslateTransform X="-1"/>
                </TransformGroup>
            </Button.RenderTransform>
        </Button>
        <Button Height="18" VerticalAlignment="Top" Content="Actions" Grid.Row="1" RenderTransformOrigin="0.5,0.5" Margin="298,0,246,0" IsHitTestVisible="False" IsTabStop="False" FontSize="10">
            <Button.RenderTransform>
                <TransformGroup>
                    <ScaleTransform/>
                    <SkewTransform/>
                    <RotateTransform/>
                    <TranslateTransform X="-1"/>
                </TransformGroup>
            </Button.RenderTransform>
        </Button>
        <Button Content="Pause" FontSize="10.667" Height="21" HorizontalAlignment="Right" Margin="0,0,27,69" Name="PauseButton" Click="PauseButton_Click" VerticalAlignment="Bottom" Width="94" Grid.Row="1" />
        <Button FontSize="10.667" Height="21" HorizontalAlignment="Left" Margin="227,0,0,69" Name="CreateNewFolderButton" Click="CreateNewFolderButton_Click" VerticalAlignment="Bottom" Width="21" Grid.Row="1">
            <Image Source="/SilverlightFTP;component/images/folder.png" />
        </Button>
        <Button FontSize="10.667" Height="21" HorizontalAlignment="Left" Margin="250,309,0,0" Name="RefreshButton" Click="RefreshButton_Click"  VerticalAlignment="Top" Width="21" Grid.Row="1">
            <Image Source="/SilverlightFTP;component/images/update.png" />
        </Button>
    </Grid>
</UserControl>
